package com.one.rope.mvp.web.common.jwt;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

/**
 * @author Weijian.liu
 * @desc 登录认证信息
 * @date 2018/12/12
 */
public class PayloadBean {

  /**
   * 用户id
   */
  @Getter
  @Setter
  private long userId;

  /**
   * 创建时间
   */
  @Getter
  @Setter
  private long createTime;

  /**
   * 超时时间
   */
  @Getter
  @Setter
  private long expires;

  @JsonIgnore
  private TokenState tokenState = TokenState.VALID;

  public TokenState getTokenState() {
    return tokenState;
  }

  public void setTokenState(TokenState tokenState) {
    this.tokenState = tokenState;
  }

  @JsonIgnore
  public boolean hasExpires() {
    return tokenState == TokenState.EXPIRED;
  }

}
